/*
 * author zby
 * 首页初始化数据
 */

(function (document, window, $, Utils) {
    'use strict';
    var vm = {};
    var result={};
    var pageParams = Utils.getUrlParams();
    $(function () {
        var fns = {
            search: function (me) {
                Utils.getSimpleJson({
                    url: "/manager/evaluate/pageCount",
                    params: Utils.getSearchParams(me),
                    fn: function (data) {
                        vm.evaluates = data;
                    }
                })
            },
        };
        window.fns = fns;
        init();
    });

    //入口方法
    function init() {
        vm = new Vue({
            el: '#tableInfo',
            data: {
                evaluates: {},
            },
        })
        Utils.getSimpleJson({
            url: "/manager/evaluate/pageCount",
            fn: function (data) {
                vm.evaluates = data;
               result = data.voList;
            }
        })
    }

    for (var i = 0; i < result.length; i++) {
        c3.generate({
            bindto: "#pie" + i,
            data: {
                columns: [
                    ['顶', result[i].good],
                    ['踩', result[i].poor]
                ],
                colors: {
                    data1: '#006DF0',
                    data2: '#933EC5'
                },
                type: 'pie'
            }
        });
    }


})(document, window, jQuery, Utils);